#! /bin/ksh
# tipwik           (does just tip#1)
# tipwik end       (does tips 1-end)
# tipwik start end (does tips start..end)
integer i
integer start
integer end

if (( $# == 0 )); then
	# tipwik
	start=1
	end=1
elif [[ "$2" != "" ]]; then
	# tipwik start end
	start=$1
	end=$2
elif [[ "$1" != "" ]]; then
	# tipwik end
	start=1
	end=$1
fi

i=${start}
while (( i <= ${end} )); do
	echo "Processing tip#".${i}
	wget -q http://vim.sourceforge.net/tips/tip.php?tip_id=${i}
	/bin/mv "tip.php?tip_id=${i}" vimtip_${i}
	vim -S "tipwik.vim" vimtip_${i}
	i=i+1
done
